<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title>Epoch权限管理系统</title>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="stylesheet" href="${baseStaticUrl}/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${baseStaticUrl}/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
    <link href="${baseStaticUrl}/hplus/css/animate.min.css" rel="stylesheet">
    <link href="${baseStaticUrl}/hplus/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <style>
    
    .dropdown-menu>li>a {
	    font-size: 13px;
	    padding-left: 11px;
	    padding-right: 11px;
	    margin-bottom: 1px;
	    margin-top: 1px;
	}
    .dropdown-menu>li>a {
	    display: block;
	    padding: 3px 20px;
	    clear: both;
	    font-weight: 400;
	    line-height: 1.42857143;
	    color: #333;
	    white-space: nowrap;
    }
    .user-menu>li>a {
    	padding: 4px 12px;
    	    height: 25px;
	}
	.dropdown-yellow>li>a:hover, .dropdown-yellow>li>a:focus, .dropdown-yellow>li>a:active, .dropdown-yellow>li.active>a, .dropdown-yellow>li.active>a:hover, .dropdown-yellow .dropdown-submenu:hover>a {
    background: #fee188;
    color: #444;
	}
    </style>
    <script src="${baseStaticUrl}/plugins/jquery/jquery-2.2.3.min.js"></script>
    <script src="${baseStaticUrl}/plugins/bootstrap/js/bootstrap.min.js"></script>      
    <script src="${baseStaticUrl}/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="${baseStaticUrl}/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <script src="${baseStaticUrl}/plugins/layer/layer.min.js"></script>
    <script type="text/javascript" src="${basePath}/js/common/MessageBox.js"></script>
	<script src="${basePath}/js/common/common.js"></script>
    <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
    <div id="wrapper">
        <!--左侧导航开始-->
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="nav-close"><i class="fa fa-times-circle"></i>
            </div>
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header" style="padding: 20px 25px;">
                        <div class="dropdown profile-element">
                            <span><img alt="image" class="img-circle" width="60px" height="60px" src="${baseStaticUrl}/adminlte/img/user1-128x128.jpg" /></span>
                             <span class="clear">
                               <span class="block m-t-xs"><strong class="font-bold" style="color:white">${session.userInfo.user_name!}</strong></span>
                             </span>
                        </div>
                    </li>
                    <epoch:menu></epoch:menu>
                </ul>
            </div>
        </nav>
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0;background: #e0e0e4;border-bottom: 1px solid #0e8ce0;height: 50px;">
                    <div class="navbar-header">
                        <form role="search" class="navbar-form-custom" method="post" action="http://www.zi-han.net/theme/hplus/search_results.html">
                            <div class="form-group">
                                <div style="margin-top: 10px;margin-left: 10px;font-size: 24px;text-shadow: none;">
                                	<small style="font-size: 85%;">Epoch<font size="2">(1.0开源版本)</font></small>
                                </div>
                            </div>
                        </form>
                    </div>
                    <ul class="nav navbar-top-links navbar-right" style="height: 40px;">
                    	<li class="dropdown ">
				            <a href="${basePath}/index/index" target= _blank>
				              <i class="fa fa-home"></i>首页
				            </a>
			        	</li>

                        <li class="dropdown">
                            <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
                                <i class="fa fa-envelope"></i> <span class="label label-primary">${infoCount!"0"}</span>
                            </a>
                            <ul class="dropdown-menu dropdown-messages">
                                @for(info in infoList){
                                <li class="m-t-xs">
                                    <div class="dropdown-messages-box">
                                        <div class="media-body">
                                            <strong>${lisFun.escapeForQuot(lisFun.getDictCode('SYS_INFO_TYPE',info.INFO_TYPE))}:&nbsp;&nbsp;</strong>${info.INFO_DESC!}
                                            <br>
                                            <small class="text-muted">${info.UPDATE_DATE!,dateFormat="yyyy-MM-dd HH:mm:ss"}</small>
                                        </div>
                                    </div>
                                </li>
                                <li class="divider"></li>
                                @}
                                <li>
                                    <div class="text-center link-block">
                                        <a class="J_menuItem" href="javascript:void(0)" onclick="toAllMessage()">
                                            <i class="fa fa-envelope"></i> <strong> 查看所有消息</strong>
                                        </a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                        <li class="dropdown" >
                        	<a class="dropdown-toggle count-info" data-toggle="dropdown" href="#" aria-expanded="false">
                                 <span><strong class="font-bold">${session.userInfo.user_name!}</strong>
                                	<b class="caret"></b>
                                </span>
                        	</a>
                        	<ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close" style="width: 200px;">
                                <li>
                                    <a href="javascript:void(0)" onclick="updatePassword()">
                                    	<i class="ace-icon fa fa-cog"></i>修改密码
                                    </a>
                                </li>
                                <li>
                                    <a href="javascript:void(0)" onclick="changeEpochStyle()" >
                                    	<i class="ace-icon fa fa-user"></i>首页风格
                                    </a>
                                </li>
                                <li>
                                    <a href="${basePath}/logout">
                                    	<i class="ace-icon fa fa-power-off"></i>退出
                                    </a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </nav>
            </div>
            <div class="row J_mainContent epochContent" id="content-main">
                <iframe scrolling="yes" name="main" frameborder="0" style="width:100%;height:100%;overflow:visible;background:#fff;" src="${basePath}/index/main"></iframe>
            </div>
        </div>
    </div>
	<epoch:winOpen id="epochStyleChange" title="风格切换" backdrop="false" width="380px" btnSave="确定">
	      <table  id="cardetail" class="table table-bordered">
	      		<tbody id="car">
					<tr class="table-list">
						<td width="340px">首页风格</td>
						<tr class="table-list">
							<td><input type="radio" value="ace" id="indexStyle" name="indexStyle">Ace风格</td>
						</tr>
						<tr class="table-list">
							<td><input type="radio" value="adminlte" id="indexStyle"  name="indexStyle">AdminLte风格</td>
						</tr>
						<tr class="table-list">
							<td><input type="radio" value="hplus" id="indexStyle"  name="indexStyle">H+风格</td>
						</tr>
					</tr>
				</tbody>
	      </table>
	</epoch:winOpen>
	<epoch:winOpen id="update_passsword" title="修改密码" backdrop="false" width="420px" btnSave="确定">
	        <div class="row visa-row">
	            <div id="wait-msg_common_password" class="alert alert-info"
	                 style="background:url({baseStaticUrl}/images/ajax-loader.gif) no-repeat scroll 0.5em 50%;display:none"></div>
	            <div id="alert-msg_common_password" class="alert alert-success" style="display:none"></div>
	            <div id="error-msg_common_password" class="alert alert-danger" style="display:none"></div>
	        </div>
	      <form class="form-horizontal">
	          <div class="form-group">
		          	<label for="firstname" class="col-sm-3 control-label">原始密码</label>
					<div class="col-sm-8">
					<input type="password" class="form-control input-sm" name="passwordOld" id="passwordOld" autocomplete="off">
					</div>
	         </div>
	          <div class="form-group">
		          	<label for="firstname" class="col-sm-3 control-label">新密码</label>
					<div class="col-sm-8">
						<input type="password" class="form-control input-sm" name="passwordNew" id="passwordNew" autocomplete="off">
					</div>
	          </div>
	          <div class="form-group">
		          	<label for="firstname" class="col-sm-3 control-label">确认密码</label>
					<div class="col-sm-8">
					<input type="password" class="form-control input-sm" id="passwordNeWToo" autocomplete="off">
					</div>
	          </div>
	      </form>
	</epoch:winOpen>
    <script src="${baseStaticUrl}/hplus/js/hplus.min.js?v=4.1.0"></script>
    <script type="text/javascript">
    
    $(function() {
		$("input[type='radio'][name='indexStyle']").eq(2).attr("checked",true);

	});
    
    function changeEpochStyle(){
		$("#epochStyleChange").modal('show');
	}
    function updatePassword(){
    	$("#update_passsword").modal('show');
    }
    $("#epochStyleChange_save").click(function () {
    	var sessionStyle = "${session.EPOCHSTYLE!}";
    	var checkStyle = $('input[name="indexStyle"]:checked').val();
    	if(checkStyle == sessionStyle){
    		MessageBox.error("已经是此样式，无需切换")
    	}else{
    		$.ajax({
                url: "${basePath}/index/changeStyle",
                data: {style:checkStyle},
                type: "post",
                success: function (result) {
                    if (result) {
                        if (result.code == "0") {
                        	MessageBox.success("样式切换成功，请重新刷新界面！");
                        } 
                    }
                },
                error: function () {
                    MessageBox.error("服务器错误，请稍后再试！");
                },
                async: false
            });
    	}
    	$("#epochStyleChange").modal('hide');
    });
    
    $("#update_passsword_save").click(function () {
        var passwordOld = $("#passwordOld").val();
        var passwordNew = $("#passwordNew").val();
        var passwordNewToo = $("#passwordNeWToo").val();
        if(passwordNew!=passwordNewToo){
            clearMessage();
            showErrorMessage("error-msg_common_password","两次密码不一致");
            return;
        }
        var userId= "${session.userInfo.id!}";
        $.post("${basePath}/sys/user/updatePassword", {
            "userId": userId,
            "passwordOld": passwordOld,
            "passwordNew": passwordNew
        }, function (msg) {
            if (msg == "true") {
                $("#cmn_label_update_passsword").modal("hide");
                $("#cmn_label_update_passsword").modal("hideModal");
                $("#passwordOld").val("");
                $("#passwordNew").val("");
                $("#passwordNeWToo").val("");
                MessageBox.success("修改密码成功");
                $("#update_passsword").modal('hide');
            } else {
                $("#cmn_label_update_passsword").modal("hide");
                $("#cmn_label_update_passsword").modal("hideModal");
                MessageBox.error("修改密码失败");
            }
        });
    });

    $("#update_passsword_close").click(function () {
    	$("#update_passsword").modal('hide');
    });
    
    function toAllMessage(){
    	window.location.hash = "/sys/info/index";
		window.main.location.href = getRootPath()+"/sys/info/index";
    }
    </script>
    <script src="${basePath}/js/index.js"></script>
</body>
</html>
